@extends('Layout/adminBase')
@section('css')
<link rel="stylesheet" type="text/css" href="{{asset('/bootstrap/css/bootstrap.min.css')}}">
<style>
  tr{
    text-align:center;
  }
  tr th{
    text-align:center;
  }

  .nbsp{
    text-align:left;
  }
</style>


@endsection
@section('body')
<div class='container'>
<div id='Common'>
 @include('Common/tip')

 </div>


<script>
  //一次性定时器 让错误提示2秒后消失
 setTimeout(function () {
      

      var common = document.getElementById('Common');

      common.style.display = 'none';

    }, 2000);
</script>

<table class="table table-condensed table-striped">
  <caption>商品分类管理</caption>
  <thead>
    <tr>
    
      <th>类别id</th>
      <th>父类名称</th>
      <th>父类pid</th>
      <th>路径path</th>
      
      <th class="oprit">操作</th>
    </tr>
</thead>
<tbody>
@foreach($type as $v)
 <?php $nbsp = str_repeat("&nbsp;",substr_count($v->path,",")*5);
 ?>
    <tr>
          <td>{{$v->id}}</td>
          
          <td class="nbsp"><?= $nbsp."|--";?>{{$v->name}}</td>
          
          <td>{{$v->pid}}</td>
          <td>{{$v->path}}</td>
          <td>
          <a  class="btn btn-success" href="{{url('/admin/Type/edit',$v->id)}}">添加子分类</a>
            <a  class="btn btn-success" href="{{url('/admin/Type/delete',$v->id)}}">删除</a>
           <a  class="btn btn-success" href="{{url('/admin/Type/show', $v->id)}}">编辑</a>
          
          </td>
        
 
      </tr>
     
    @endforeach
    
    </tr>
  </tbody>
</table>
 {{$type->links()}}


</div>
@endsection